package _220326;

/**
 * @author ShadowLim
 * @create 2022-03-26-9:22
 */
public class 古堡算式 {

    public static void main(String[] args) {
        for (int a = 1; a < 10; a++) {
            for (int b = 0; b < 10; b++) {
                if (a == b) continue;
                for (int c = 0; c < 10; c++) {
                    if (c == b || c == a) continue;
                    for (int d = 0; d < 10; d++) {
                        if (d == c || d == b || d == a) continue;
                        for (int e = 1; e < 10; e++) {
                            if (e != d && e != c && e != b && e != a) {
                                for (int f = 0; f < 10; f++) {
                                    int x = a * 10000 + b * 1000 + c * 100 + d * 10 + e;
                                    int y = e * 10000 + d * 1000 + c * 100 + b * 10 + a;
                                    if (x * f == y) {
                                        System.out.println(x);
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
